package example.array;

/**
 * Created by lenovo on 2016/11/4 0004.
 * 数组的输出元素，Arrays.toString可以输出一个string，包含所有数组元素信息。
 * 而此处，需要的是打印出所有单个的元素
 */
public class Print {
    public static void main(String[] args) {
        String[] greeting = new String[3];
        greeting[0] = "This is the greeting";
        greeting[1] = "for all the reader from";
        greeting[2] = "Java Source .";
        for (int i = 0; i < greeting.length; i++) {
            System.out.println(greeting[i]);
        }

        //foreach方式
        for (String s : greeting) {
            System.out.println(s);
        }
    }
}
